package jk.spider.util.extract.config;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import jk.spider.util.extract.Extracts;

public abstract class ParserConfig {
	protected static final Logger log = Logger.getLogger(ParserConfig.class);
	protected List<String> title;
	protected List<String> address;
	protected List<String> tel;
	protected List<String> fax;
	protected List<String> category;
	protected String dbUrl;
	protected Class iClass;
	protected Extracts extract;
	
	public ParserConfig() {
		dbUrl = "";
		title = new ArrayList<String>();
		address = new ArrayList<String>();
		tel = new ArrayList<String>();
		fax = new ArrayList<String>();
		category = new ArrayList<String>();
	}
	
	public List<String> getTitle() {
		return title;
	}

	public void setTitle(List<String> title) {
		this.title = title;
	}

	public List<String> getAddress() {
		return address;
	}

	public void setAddress(List<String> address) {
		this.address = address;
	}

	public List<String> getTel() {
		return tel;
	}

	public void setTel(List<String> tel) {
		this.tel = tel;
	}
	
	public List<String> getFax() {
		return fax;
	}

	public void setFax(List<String> fax) {
		this.fax = fax;
	}

	public String getDbUrl() {
		return dbUrl;
	}

	public void setDbUrl(String dbUrl) {
		this.dbUrl = dbUrl;
	}
	
	public Object getIClass() {
		try {
			extract = (Extracts) iClass.newInstance();
		} catch (IllegalAccessException e) {
			log.error("setIClass IllegalAccessException", e);
		} catch (InstantiationException e) {
			log.error("setIClass InstantiationException", e);
		} catch (Exception e) {
			log.error("setIClass Exception", e);
		}
		return extract;
	}
	
	public Class getPClass() {
		return iClass;
	}

	public void setIClass(String class1) {
		try {
			iClass = Class.forName(class1);
		} catch (ClassNotFoundException e) {
			log.error("setIClass ClassNotFoundException", e);
		} catch (Exception e) {
			log.error("setIClass Exception", e);
		}
	}

	public List<String> getCategory() {
		return category;
	}

	public void setCategory(List<String> category) {
		this.category = category;
	}
}
